import { NEWS_SAVE_LIST } from '../action/actionTypes';

const initialState = {
  // 1. 在reducer函数中,声明状态
  articles: [],
};

const newsReducer = (state = initialState, { type, payload }) => {
  switch (type) {
    // 4. reducer函数完成保存的计算
    case NEWS_SAVE_LIST:
      return { ...state, articles: payload };

    default:
      return state;
  }
};

export default newsReducer;
